#include "bsp_freertos.h"
#include "shell_port.h"
#include "bsp_gd32f4_flash.h"
#include "bsp_led.h"
#include "bsp_rtc.h"


/***************************************************************************************************/
void vApplicationStackOverflowHook( TaskHandle_t xTask,char * pcTaskName ){
	debug_printf("vApplicationStackOverflowHook\r\n");
}
void vApplicationIdleHook( void ){
	// debug_printf("idle is running\r\n");
}
void vApplicationTickHook( void ){
	// debug_printf("vApplicationTickHook\r\n");
}
void vApplicationMallocFailedHook( void ){
	debug_printf("vApplicationMallocFailedHook\r\n");
}
/***************************************************************************************************/
TaskHandle_t main_handle;
void main_task_entry(void *pvParameters){
	bsp_debug_led_init();
	bsp_rtc_init();
	while(1){
		vTaskDelay(1000);
		bsp_debug_led1_toggle();
		bsp_rtc_show_date_time();
	}
}
/***************************************************************************************************/
void task_init(void){
	BaseType_t xHandle = NULL;
	
	userShellInit();
	
	xHandle = xTaskCreate(main_task_entry,"main task",configMINIMAL_STACK_SIZE*8,NULL,tskIDLE_PRIORITY+30,&main_handle);
	if(xHandle == pdPASS){
			debug_printf("%s:main task create success!\r\n",Get_Core_Run_Time_Str());
	}
	else{
			debug_printf("%s:main task create error!\r\n",Get_Core_Run_Time_Str());
	}
}